From: Ray Strode Date: Tue, 27 Aug 2013 14:17:26 +0000 (-0400) Subject: authPrompt: give message label an initial style X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~3604 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=88e3f6af47cc3efae27453330725abbb514bbef9;p=gnome-shell.git authPrompt: give message label an initial style This commit consolidates the styles of the various message types into one 'login-dialog-message' style and then adds additional styles on top to cover the differences. This allows us to give the message label an initial style so that is padded properly before any messages are displayed. https://bugzilla.gnome.org/show_bug.cgi?id=706670 --- diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css index 176d4322e..bfb52dc4b 100644 --- a/data/theme/gnome-shell.css +++ b/data/theme/gnome-shell.css @@ -2433,8 +2433,7 @@ StScrollBar StButton#vhandle:active { background-color: rgba(102, 102, 102, 0.15); } -.login-dialog-message-warning, -.login-dialog-message-info { +.login-dialog-message { padding-top: 4px; padding-bottom: 16px; min-height: 2em; @@ -2445,8 +2444,7 @@ StScrollBar StButton#vhandle:active { } .login-dialog-message-hint { - padding-bottom: 16px; - min-height: 2em; + padding-top: 0px; } .user-widget-label { diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js index 73763f365..90fefcfc3 100644 --- a/js/gdm/authPrompt.js +++ b/js/gdm/authPrompt.js @@ -36,8 +36,6 @@ const BeginRequestType = { DONT_PROVIDE_USERNAME: 1 }; -let _messageStyleMap; - const AuthPrompt = new Lang.Class({ Name: 'AuthPrompt', @@ -109,7 +107,8 @@ const AuthPrompt = new Lang.Class({ this._entry.grab_key_focus(); - this._message = new St.Label({ opacity: 0 }); + this._message = new St.Label({ opacity: 0, + styleClass: 'login-dialog-message' }); this._message.clutter_text.line_wrap = true; this.actor.add(this._message, { x_fill: true, y_align: St.Align.START }); @@ -371,27 +370,22 @@ const AuthPrompt = new Lang.Class({ }); }, - _initMessageStyleMap: function() { - if (_messageStyleMap) - return; - - _messageStyleMap = {}; - _messageStyleMap[GdmUtil.MessageType.NONE] = ''; - _messageStyleMap[GdmUtil.MessageType.ERROR] = 'login-dialog-message-warning'; - _messageStyleMap[GdmUtil.MessageType.INFO] = 'login-dialog-message-info'; - _messageStyleMap[GdmUtil.MessageType.HINT] = 'login-dialog-message-hint'; + setMessage: function(message, type) { + if (type == GdmUtil.MessageType.ERROR) + this._message.add_style_class_name('login-dialog-message-warning'); + else + this._message.remove_style_class_name('login-dialog-message-warning'); - }, + if (type == GdmUtil.MessageType.HINT) + this._message.add_style_class_name('login-dialog-message-hint'); + else + this._message.remove_style_class_name('login-dialog-message-hint'); - setMessage: function(message, type) { - this._initMessageStyleMap(); if (message) { Tweener.removeTweens(this._message); this._message.text = message; - this._message.styleClass = _messageStyleMap[type]; this._message.opacity = 255; } else { - this._message.styleClass = null; this._message.opacity = 0; } },